package top.lixunda.commerce.common.core.controller.wrapper;

import java.io.Serializable;

/**
 * @author LiXunda
 * @version time:2019/10/14 9:42
 */
public class QueryEntityBlock<T> extends EntityBlock<T> implements ISelectEntityBlock, Serializable {

    private static final String DEFAULT = null;

    public QueryEntityBlock() {
        this.setType(TYPE_ALL);
    }

    @Override
    public ISelectEntityBlock selectAll() {
        this.setType(TYPE_ALL);
        return this;
    }

    @Override
    public ISelectEntityBlock select(String... columns) {
        this.setType(TYPE_CHOICE);
        if (columns != null) {
            for (String column : columns) {
                if (column != null && !"".equals(column)) {
                    this.getColumns().put(column, DEFAULT);
                }
            }
        }
        return this;
    }
}
